﻿using System;
using System.Windows.Input;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MVVM.Northwind.Employee.Commands
{
    public class MVVMRoutedCommand:ICommand
    {
        Action<object> _execute;
        Predicate<object> _canExecute;
        public MVVMRoutedCommand(Action<object> execute, Predicate<object> canExecute)
        {
             _execute = execute;
            _canExecute = canExecute;
        }
        public bool CanExecute(object parameter)
        {
            return parameter ==null? true:_canExecute(parameter);
        }

        public event EventHandler CanExecuteChanged;

        public void Execute(object parameter)
        {
            _execute(parameter);
        }        
    }
}
